proc do_userlist {nick chan host otbn1} {
  global botnick home bcast    

  if {![validchan $chan]} {
    putquick "NOTICE $nick :\0034ERROR - This bot is not used in $chan."
    return 0
  }
 
  # Convert access type to lowercase
  set otbn1 [string tolower $otbn1]

  putlog "!$nick ($host)! userlist $chan $otbn1"

  # Figure out what flags to look for...
  if {$otbn1 == "all" || $otbn1 == "" || $otbn1 == "local" } {
    set otbn1 "ALL"
    set Xshowflags "|f"
  } elseif {$otbn1 == "avoice"} {
    set Xshowflags "|v"
  } elseif {$otbn1 == "op"} {
    set Xshowflags "|o"
  } elseif {$otbn1 == "ccadmin"} {
    set Xshowflags "|m"
  } elseif {$otbn1 == "cadmin"} {
    set Xshowflags "|n"
  } elseif {$otbn1 == "bop"} {
    set Xshowflags "o"
  } elseif {$otbn1 == "bcadmin"} {
    set Xshowflags "m"
  } elseif {$otbn1 == "root"} {
    set Xshowflags "n"
  } elseif {$otbn1 == "global"} {
    set Xshowflags "fnmo"
  }

  if {$bcast == "1"} {
    putquick "PRIVMSG $home :$nick!$host requested userlist for $otbn1 users in $chan ..showing.."
  }

  putquick "NOTICE $nick :\00312Current user listing for\0034 $otbn1 \00312users in\0034 $chan:"
  putquick "NOTICE $nick :[userlist $Xshowflags $chan]"
  putquick "NOTICE $nick :\0033For details on a specified user type 12(/msg) $botnick access <user>"

}







